package net.csdn.business.discuss.api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.csdn.business.discuss.api.model.entity.DiscussActivity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

/**
 * @ClassName DiscussActivityMapper
 * @Description TODO
 * @Author zhangyl
 * @Date 2023/7/22 10:15
 */
public interface DiscussActivityMapper extends BaseMapper<DiscussActivity> {


    /**
     * @Author zhangyl
     * @Description 查询讨论最近活动用户的id
     * @Date 16:07 2023/8/16
     * @Param
     * @return
     **/
    @Select(" SELECT t.uid FROM ( select uid,max(created_date) as created_date " +
            " FROM discuss_activity where discuss_id = #{discussId} " +
            " GROUP BY uid) t " +
            " ORDER BY t.created_date DESC limit 50 ")
    public List<String> selectRecentRelateUser(@Param("discussId")String discussId);



    @Select(" select uid FROM discuss_activity where discuss_id = #{discussId} GROUP BY uid ")
    public List<String> selectRelateUser(@Param("discussId")String discussId);

}
